<template>
	<view>
		
		<view class="item" style="padding: 20rpx 30rpx 0;">
		
			<u-form :model="addbean" ref="uform" label-width="auto">
				
				<u-form-item label="预计过户时间" borderBottom>
					<u-input v-model="transferTime" inputAlign="right" disabled
						disabledColor="#ffffff" border="none" placeholder="--"></u-input>
				</u-form-item>
				
				<u-form-item label="实际过户时间" required borderBottom @click="timeShow=true">
					<u-input v-model="addbean.transferTime" inputAlign="right" disabled
						disabledColor="#ffffff" border="none" placeholder="请选择过户时间"></u-input>
					<u-icon slot="right" name="arrow-right"></u-icon>
				</u-form-item>
		
				<u-form-item label="过户备注信息" borderBottom>
					<u-input v-model="addbean.remarks" inputAlign="right" placeholder="请输入过户备注信息" border="none"></u-input>
				</u-form-item>
		
				
				<view style="display: flex;flex-direction: column;">
					<u-form-item label="上传过户资料">
						<!-- <view class="car-photo" style="padding: 20rpx 0; display: block;font-size: 30rpx;color: #333;">订单附件</view> -->
					</u-form-item>
					
					<lr-upload ref="upload1" tag="1" @on-change="uploadOnChange"></lr-upload>
				</view>
				
			</u-form>
			
		</view>
		
		<view style="height: 100rpx;"></view>
		
		<view class="button-container">
			<button class="btn-item" @click="commit">保存</button>
		</view>
		
		<!-- 还款时间 -->
		<u-datetime-picker
			:show="timeShow"
			mode="date" @confirm="timeConfirm"
			@cancel="timeShow=false"></u-datetime-picker>
		
	</view>
</template>

<script>
	import lrUpload from '@/components/global/lr-upload.vue'
	export default {
		components: {
			lrUpload,
		},
		data() {
			return {
				timeShow:false,
				model:{},
				addbean:{
					transferTime:'',
					accessory:[],
				},
				orderId:'',
				orderCarNo:'',
				carId:'',
				transferTime:'',
			}
		},
		methods: {
			
			//图片上传成功回调
			uploadOnChange(tag, resultList, resultObjList) {
				console.log(tag, resultList, resultObjList);
				switch (tag) {
					case '1': //订单附件
						this.addbean.accessory = resultList;
						break
				}
			},
			
			timeConfirm(e){
				let timeStr = uni.$u.timeFormat(e.value, 'yyyy-mm-dd');
				
				this.timeShow = false;
				this.addbean.transferTime = timeStr;
			},
			
			commit(){
				let that = this
				
				if(uni.$u.test.isEmpty(this.addbean.transferTime)){
					this.$u.toast('请选择实际过户时间')
					return
				}
				
				
				uni.showModal({
					title:'确定提交吗?',
					success:(res)=>{
						if(res.confirm){
							that.$u.api.addCartransfer(that.addbean).then(res=>{
								that.$u.toast('提交成功')
								setTimeout(()=>{
									uni.navigateBack()
								}, 1000)
							})
						}
					}
				})
			},
			
			
		},
		onLoad(op) {
			this.orderId = 'null'!=op.orderId?op.orderId:''
			this.orderCarNo = 'null'!=op.orderCarNo?op.orderCarNo:''
			this.carId = 'null'!=op.carId?op.carId:''
			this.transferTime = 'null'!=op.transferTime?op.transferTime:''
			
			this.addbean.orderNo = this.orderId
			this.addbean.orderCarNo = this.orderCarNo
			this.addbean.carId = this.carId
			this.addbean.estimatedTransferTime = this.transferTime
			
		}
	}
</script>

<style>

</style>
